Subject: Re: help with error: NEAR/FAR reference
From: [email-masked] (Doug Walker)
Date: 16 Nov 92 13:58:30 GMT
Newsgroups: comp.sys.amiga.programmer

In article <[email-masked]>, [email-masked] (Aaron  Ramsey) writes:
|> I've got a program that gives me a warning.. and I can't figure it out..
|> 
|> <programname> 209 Warning 169: too much global data for NEAR reference, change
|> 			       some to FAR
|> 
|> How do I change it to FAR reference? I'm using SAS 5.10. I tried moving my

Put the __far keyword on one or more of your larger data items,
or compile with the -b0 option to make all data references far.
If you use -b0, make sure to link with the 'nb' versions of the
libraries - the LC command will do this automatically for you,
but if you use BLINK directly, you will have to modify your
library list.

|> subroutines around to try and compensate for any jumps being made by calls to
|> subroutines, but it made no difference. This error shows up at the very 
|> last line of my program (which happens to be blank). How can I get rid of this?
|> And what is causing it exactly? My main() is about 160 line or so, with
|> quite a few if statements... nothing that I would have thought would take
|> up tons of memory when put into assemly... I dunno.

It isn't your CODE that's too big, it's your DATA - read the message.
You have more data than can be accessed via a 16-bit offset, so you
have to tell the compiler to generate 32-bit offsets to at least 
some of it.  The __far keyword tells it to generate 32-bit offsets
to the marked items; -b0 tells it to generate 32-bit offsets to
everything.

Another thing to consider would be to allocate space for that large
array dynamically instead of declaring it as an extern.  Use the
malloc() function and the memory will automatically be freed when
you exit.  (I assume you have a large array since I doubt that you
have declared 64k worth of non-array "int" variables 8^)

|> -Aaron Ramsey...........  bewildered beginning C programmer.  8-)

-- 
  *****
=*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
 *|. o.| ||                                          1200/2400/9600 Dual
  | o  |//     For all you do, this bug's for you!
  ====== 
usenet: [email-masked]                            bix: djwalker 
Any opinions expressed are mine, not those of SAS Institute, Inc.